<template>
  <div>

    <div style="position: fixed; top: 0; z-index: 999;">
      <university-tab :selected="currentTab" @selectTab="onTabSelected"></university-tab>
    </div>
    <div style="height: 49px"></div>
    <transition>
      <keep-alive>
        <router-view />
      </keep-alive>
    </transition>


  </div>
</template>

<script>

  import UniversityTab from './components/UniversityTotalTab'

  export default {
    name: "university-total",
    data() {
      return {
        currentTab: 0,
      }
    },
    components: {
      UniversityTab,
    },
    created() {

      if (this.$route.path.includes('/university/total/chart')) {
        this.currentTab = 0
      } else if (this.$route.path.includes('/university/total/ranking')) {
        this.currentTab = 1
      } else if (this.$route.path.includes('/university/total/team')) {
        this.currentTab = 2
      } else {
        this.currentTab = 0
      }

      switch (this.currentTab) {
        case 0:
          this.$_router.replace('/university/total/chart')
          break
        case 1:
          this.$_router.replace('/university/total/ranking')
          break
        case 2:
          this.$_router.replace('/university/total/team')
          break
      }
    },
    mounted() {


    },
    methods: {
      onTabSelected(data) {
        this.currentTab = data.tab
      },
    }
  }
</script>

<style scoped>

</style>
